package com.swsm.controller;

import java.util.Date;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONObject;
import com.swsm.Constant;
import com.swsm.model.bean.B2SPaperReviewBean;
import com.swsm.service.PaperService;

@Controller
public class PaperController {

	private Logger logger = LoggerFactory.getLogger(PaperController.class);
	
	@Autowired
	private PaperService service;
	
	@RequestMapping("/paper.html")
	public String goToPaper() {
		return "Paper";
	}
	
	@ResponseBody
	@RequestMapping("/t/paperReview")
	public String paperReview(B2SPaperReviewBean bean) {
		logger.info("=====> 审核论文信息");
		JSONObject result = new JSONObject();

		try {
			service.paperReview(bean);
			result.put("status", Constant.INSTANSE.OK);
			result.put("msg", "审核论文信息成功！");
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			result.put("status", Constant.INSTANSE.SERVSER_ERROR);
			result.put("msg", "服务器内部错误！");
		}
		result.put("time", new Date());
		
		return result.toJSONString();
	}
}
